import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import * as path from 'path'
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': path.join(__dirname, 'src'),
      '#': path.join(__dirname, 'types')
    }
  },
    server: {
      port: 3000,//端口号
      host: '0.0.0.0',// 允许外部ip访问
      cors: true, // 允许跨域
      open: true,//自动打开浏览器
      proxy: {
        '/dev-api': {
          // target: 'https://api-gc.vip2.com.cn',
          target: 'http://121.28.219.118:3001',
          // target: 'https://gc.vip2.com.cn/prod-api',
          changeOrigin: true,
          rewrite: (p) => p.replace(/^\/dev-api/, '')
        },
        '/qianwen-api': {
          // target: 'https://api-gc.vip2.com.cn',
          target: 'https://dashscope.aliyuncs.com/api/v1',
          // target: 'https://gc.vip2.com.cn/prod-api',
          changeOrigin: true,
          rewrite: (p) => p.replace(/^\/qianwen-api/, '')
        }
      }
    },
  base: './',//打包路径
})
